﻿using Entitas;

public sealed class InputSystem : IExecuteSystem, IInitializeSystem
{
    private readonly IInputService _inputService;

    public InputSystem(IInputService inputService)
    {
        _inputService = inputService;
    }

    public void Initialize()
    {
        _inputService.Initialize();
    }

    public void Execute()
    {
        var entities = Contexts.sharedInstance.game.GetEntities(GameMatcher.Input);
        foreach (var e in entities)
        {
            InputOp inputOp = _inputService.HandleInput(e.input.inputId);

            e.ReplaceInput(e.input.inputId, inputOp);
        }
    }


}